#ifndef _BASE2chTextView_
#define _BASE2chTextView_
//-------------------------------------------------------------------------------------------------------
//      Copyright (c) 2005-2009, Be Nanashi-San 
// 
//      Permission is hereby granted, free of charge, to any person obtaining a 
//      copy of this software and associated documentation files (the "Software"), 
//      to deal in the Software without restriction, including without limitation 
//      the rights to use, copy, modify, merge, publish, distribute, sublicense, 
//      and/or sell copies of the Software, and to permit persons to whom the 
//      Software is furnished to do so, subject to the following conditions: 
// 
//      The above copyright notice and this permission notice shall be included in 
//      all copies or substantial portions of the Software. 
// 
//      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
//      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
//      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
//      AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
//      LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
//      FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
//      DEALINGS IN THE SOFTWARE. 
// 
//      File Name:   	Base2chTextView.h
//      Author:      	Be Nanashi-San@598 in "BeOS - Zeta R4" Thread 
//						(http://pc8.2ch.net/test/read.cgi/os/1120676818/598)
//		Description:	互換Base2chTextView.
//-------------------------------------------------------------------------------------------------------

#include <TextView.h>
#include "MUtils.h"

const uint32 kMSG_BORN_BABY	= 'Baby';
const uint32 kMSG_THREAD_END = 'Tend';
const uint32 kMSG_EXITED_VIEW = 'Vout';
const uint32 kMSG_MOUSE_UP = 'Mup ';
const uint32 kMSG_MOUSE_CLICK = 'Sclk';
const uint32 kMSG_GOOGLE = 'Ggle';
const uint32 kMSG_COPY_LOCATION = 'Clca';
const uint32 kMSG_CHECK_LOCATION = 'Chca';
const uint32 kMSG_COPY_THREAD = 'Cthd';
const uint32 kMSG_RELOAD = 'Trld';

class BPopUpMenu;
class Base2chTextView : public BTextView
{
	public:
		Base2chTextView(const char *name, uint32 flags = B_WILL_DRAW | B_PULSE_NEEDED);
		virtual ~Base2chTextView(); 
		void AttachedToWindow();
		void FrameResized(float width, float height);
		void SetDisplayFont();

		virtual void SetInvoke(const char *name, int32 length);
		virtual void SetInvoke(const char *name, int32 size, int32 length);
		void DiaplayThread(int32 no, const char **argv);
		void AdjustTextRect();	
	
	protected:
		int32 is_number(int32 offset);
		BPoint fMousePoint;
		BPoint fStatic_where;
		
	private:
		void HtmlParser(const char *text);
		void InsertThread(int32 i, Base2chTextView *outView);

		static MStyle PLAIN;
		static MStyle BOLD;
		static MStyle LINK;
		static MStyle SAGE;
		static MStyle AGE;
};

#endif
